#pragma once
#include "DJoint.h"

namespace Skill
{
	namespace Ode
	{
		ref class DWorld;
		ref class DVector3;
		namespace Joints
		{
			ref class DJointGroup;
			public ref class DHinge2 : DJoint
			{
			protected:
				virtual void CollectManagedMemory() override;
			public:

				///<summary>
				/// Create a new joint of the hinge2 type.
				///</summary>
				///<param name = "world"> Wrold </param>
				///<param name = "group">
				/// set to null to allocate the joint normally.
				/// If it is valid the joint is allocated in the given joint group.
				///</param>				
				DHinge2(DWorld^ world , DJointGroup^ group);

				///<summary>				
				/// Gets or set the joint anchor point, in world coordinates.
				///</summary>				
				///<returns>
				/// the point on body 1.  If the joint is perfectly satisfied,
				/// this will be the same as the point on body 2.
				///</returns>
				REF_PROP_DECLARATION_GETSET(DVector3,Anchor1);

				///<summary>				
				/// Get the joint anchor point, in world coordinates.
				/// This returns the point on body 2. If the joint is perfectly satisfied,
				/// this will return the same value as dJointGetHinge2Anchor.
				/// If not, this value will be slightly different.
				/// This can be used, for example, to see how far the joint has come apart.
				///</summary>
				REF_PROP_DECLARATION_GET(DVector3,Anchor2);

				///<summary>
				/// set axis
				///</summary>
				REF_PROP_DECLARATION_GETSET(DVector3,Axis1 );

				///<summary>
				/// set axis
				///</summary>
				REF_PROP_DECLARATION_GETSET(DVector3,Axis2);

				///<summary>
				/// set joint parameter
				///</summary>
				void SetParam(DJointParameters parameter, dReal value);	

				///<summary>
				/// Get joint parameter
				///</summary>
				dReal GetParam(DJointParameters parameter);

				///<summary>
				/// Applies torque1 about the hinge2's axis 1, torque2 about the
				/// hinge2's axis 2.
				///</summary>
				///<remarks> This function is just a wrapper for dBodyAddTorque(). </remarks>
				void AddTorques(dReal torque1, dReal torque2);				

				///<summary>
				/// Get angle
				///</summary>
				VALUE_PROP_DECLARATION_GET(dReal,Angle1);

				///<summary>
				/// Get time derivative of angle
				///</summary>
				VALUE_PROP_DECLARATION_GET(dReal,Angle1Rate);

				///<summary>
				/// Get time derivative of angle
				///</summary>
				VALUE_PROP_DECLARATION_GET(dReal,Angle2Rate);
			};
		}
	}
}